<?php

/**
 * Transaction form base class.
 *
 * @method Transaction getObject() Returns the current form's model object
 *
 * @package    Amawal Invest
 * @subpackage form
 * @author     Ameen Shoman<amin.shoman@gmail.com>
 */
abstract class BaseTransactionForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                => new sfWidgetFormInputHidden(),
      'employee_id'       => new sfWidgetFormPropelChoice(array('model' => 'Employee', 'add_empty' => true)),
      'transaction_type'  => new sfWidgetFormInputText(),
      'leave_type_id'     => new sfWidgetFormPropelChoice(array('model' => 'CodeLeaveType', 'add_empty' => true)),
      'vacation_type'     => new sfWidgetFormInputText(),
      'date_from'         => new sfWidgetFormDateTime(),
      'date_to'           => new sfWidgetFormDateTime(),
      'period'            => new sfWidgetFormInputText(),
      'created_at'        => new sfWidgetFormDateTime(),
      'updated_at'        => new sfWidgetFormDateTime(),
      'notification_flag' => new sfWidgetFormInputCheckbox(),
      'approve_flag'      => new sfWidgetFormInputCheckbox(),
      'modification_flag' => new sfWidgetFormInputCheckbox(),
      'branch_id'         => new sfWidgetFormPropelChoice(array('model' => 'Branch', 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'id'                => new sfValidatorPropelChoice(array('model' => 'Transaction', 'column' => 'id', 'required' => false)),
      'employee_id'       => new sfValidatorPropelChoice(array('model' => 'Employee', 'column' => 'id', 'required' => false)),
      'transaction_type'  => new sfValidatorInteger(array('min' => -128, 'max' => 127, 'required' => false)),
      'leave_type_id'     => new sfValidatorPropelChoice(array('model' => 'CodeLeaveType', 'column' => 'id', 'required' => false)),
      'vacation_type'     => new sfValidatorInteger(array('min' => -128, 'max' => 127, 'required' => false)),
      'date_from'         => new sfValidatorDateTime(array('required' => false)),
      'date_to'           => new sfValidatorDateTime(array('required' => false)),
      'period'            => new sfValidatorNumber(array('required' => false)),
      'created_at'        => new sfValidatorDateTime(array('required' => false)),
      'updated_at'        => new sfValidatorDateTime(array('required' => false)),
      'notification_flag' => new sfValidatorBoolean(array('required' => false)),
      'approve_flag'      => new sfValidatorBoolean(array('required' => false)),
      'modification_flag' => new sfValidatorBoolean(array('required' => false)),
      'branch_id'         => new sfValidatorPropelChoice(array('model' => 'Branch', 'column' => 'id', 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('transaction[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Transaction';
  }


}
